package com.zgm.ch04._2_2_3;

import java.io.BufferedInputStream;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class ShutdownHookDemo {

	public static void main(String[] args) throws Exception {
		XmlBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("com/zgm/ch04/_2_2_2/_2_2_2-context.xml"));
		System.out.println(beanFactory.getBean("destructBean"));
		//钩子没有执行 ？？？
		Runtime.getRuntime().addShutdownHook(new Thread(new ShutdownHook(beanFactory)));
		
		new BufferedInputStream(System.in).read();
	}
}
